package 课外知识;

import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform;

/**
 * ClassName: java调用lua脚本
 * Package: 课外知识
 * Description:
 *
 * @Author 张蛟龙
 * @Create 2024/7/9 20:06
 * @Version 1.0
 */
public class java调用lua脚本 {
    public static void main(String[] args) {
        //java时间lua 脚本
        Globals globals = JsePlatform.standardGlobals();
        LuaValue load = globals.load("print('hello word')");
        LuaValue call = load.call();

        String tojstring = globals.load("return 5").call().tojstring();

        System.out.println(tojstring);


    }
}
